package com.scetop.bank;


import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Customer {
    private final String firstName;

    private final String lastName;

    //    private final Account [] accounts;
//    private  int numberOfAccounts;
    private final List<Account> accounts;



    public Customer(String f, String l){
        firstName = f;
        lastName = l;

//        accounts = new Account[2];
        accounts = new ArrayList<>();

    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }



    public void addAccount(Account account){
//        accounts[numberOfAccounts++] = account;
        accounts.add(account);
    }

    public Account getAccount(int index){
//        return accounts[i];
        return accounts.get(index);
    }

    public int getNumOfAccounts(){
//        return numberOfAccounts;
        return accounts.size();
    }

    public void setAccount(Account account) {
        addAccount(account);
    }
    public Iterator<Account> getAccounts(){
        return accounts.iterator();
    }
}
